package com.enumdemo.multi_channel_distribution.demo3;

import static com.enumdemo.multi_channel_distribution.demo1.Outcome.*;
import com.enumdemo.multi_channel_distribution.demo1.Outcome;
import com.enumdemo.multi_channel_distribution.demo5.RoShamBo;
import com.enumdemo.multi_channel_distribution.demo5.face.Competitor;

/**
 * 通过表驱动的代码实现多路分发
 * 
 * @author Administrator
 *
 */
public enum RoShamBo3 implements Competitor<RoShamBo3> {

	PAPER {

		@Override
		public Outcome compete(RoShamBo3 it) {
			switch (it) {
			case PAPER:
				return DRAW;
			case SCISSORS:
				return LOSE;
			case ROCK:
				return WIN;
			default:
				break;
			}
			return null;
		}

	},
	SCISSORS {

		@Override
		public Outcome compete(RoShamBo3 it) {
			switch (it) {
			case PAPER:
				return WIN;
			case SCISSORS:
				return DRAW;
			case ROCK:
				return LOSE;
			default:
				break;
			}
			return null;
		}

	},
	ROCK {

		@Override
		public Outcome compete(RoShamBo3 it) {
			switch (it) {
			case PAPER:
				return LOSE;
			case SCISSORS:
				return WIN;
			case ROCK:
				return DRAW;
			default:
				break;
			}
			return null;
		}

	};

	public abstract Outcome compete(RoShamBo3 it);

	public static void main(String[] args) {
		System.out.println("开始");
		RoShamBo.play(RoShamBo3.class, 20);
	}

}
